<html>
	<head>
		<title> Project Barbalbero: Prova </title>
		<script type="text/javascript" src="jquery.js"></script>
		<script type="text/javascript" src="XPath_client.js"></script>
		<script type="text/javascript" src="frameworkFunctions_client.js"></script>

		<script type="text/javascript">
		  function OnLoad () {
						
			var scrivi = document.getElementById('testo');
			var figlio = document.getElementById('figlio');
			scrivi.innerHTML+="<br>partito<br>";
	
			
			var hypers = __selectElements(document, ".//hypernode");
			var figli = __selectElements(document,".//div");
	
			__remoteAppendChild(hypers[0],".",figlio);			
			__remoteAppendChild(hypers[0],".",figli[0]);
			
			scrivi.innerHTML+="<br>fine<br>";
		  }
		  
		  function AddNews() {
			
			var msg = __selectElements(document, ".//textarea[@name='message']");
			
			var hypers = __selectElements(document, ".//hypernode");
			//__setContents(hypers[0], "", __selectContents(hypers[0], "/news")[0]+"<div>"+msg[0]+"</div>");
			__setContent(hypers[0], ".//news","<div>"+msg[0].value+"</div>");
			//__selectElements(hypers[0], ".//news/*");
			/*
			var news = __selectElements(hypers[0], ".//news")[0];
			var newElement = document.createElement("div");
			newElement.innerHTML = msg[0].value;
			news.appendChild(newElement);
			news.commit();
			*/
		  }
		</script>
	</head>

	<body onload="OnLoad();">
		<div>
		  <p>Semplice pagina di prova in sottodir</p>
		</div>
		<div id="news">
		<div/>
		<div id="ciao"/>
		</div>
		<textarea name="message" cols="40" rows="5" value="Test message">Prova</textarea>
		<button onclick="AddNews()">Aggiungi notizia</button>
		<hypernode refname="news">
		<hypernode refname="lastnews">
		<div id="figlio">Figlio da appendere</div>
		<div id="testo"></div>
	</body>
</html>
	
